#include "mythread.h"


myThread::myThread(QObject *parent)
    : QObject(parent)
    , is_running(true)
{

}

void myThread::my_timeout()
{
    while (getIsRunning()) {

        QThread::sleep(1);
        // 发送一个信号
        emit my_signal();
        qDebug() << "child thread id == " << QThread::currentThread();
        if (!getIsRunning()) {
            break;
        }
    }
}

void myThread::setIsRunning(bool flag)
{
    is_running = flag;
}

bool myThread::getIsRunning()
{
    return is_running;
}
